package com.woniu.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woniu.model.DepotDetial;
import com.woniu.model.Result;
import com.woniu.service.DepotService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;
import java.util.UUID;

/**
 * <p>
 *  仓库详情相关接口
 * </p>
 *
 * @author eason
 * @since 2024年05月23日
 */
@RestController
@Api(tags = "仓库详情相关接口")
@RequestMapping("/depotDetial")
public class DepotDetialController {
    @Resource
    private DepotService depotDetialService;

    /**
     *根据站点id查询仓库信息list
     * @param id 站点id
     * @return 仓库信息List
     */
    @GetMapping("/findByStationId/{id}")
    @ApiOperation("根据站点id查询仓库信息list")
    public Result<List<DepotDetial>> findByStationId(@PathVariable("id") Integer id) throws Exception {
        List<DepotDetial> detial = depotDetialService.findByStationId(id);
        return Result.newListInstance(DepotDetial.class).setCode(200).setData(detial).setMessage("根据站点id查询仓库信息成功!");
    }

    /**
     *根据站点id查询仓库信息Page
     * @param id 站点id
     * @return 仓库信息Page
     */
    @GetMapping("/findByStationIdPage")
    @ApiOperation("根据站点id查询仓库信息Page")
    public Result<Page<DepotDetial>> findByStationIdPage(@RequestParam("id") Integer id,@RequestParam("pageNum") Integer pageNum,@RequestParam("pageSize") Integer pageSize) throws Exception {
        Page<DepotDetial> detial = depotDetialService.findByStationIdPage(id,pageNum,pageSize);
        return Result.newPageInstance(DepotDetial.class).setCode(200).setData(detial).setMessage("根据站点id查询仓库信息成功!");
    }

}